<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%--
  Created by IntelliJ IDEA.
  User: YanHilin
  Date: 2020/5/28
  Time: 13:18
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>搜索</title>
    <base href="http://localhost:8080/onlineflower/">
    <%@ include file="/page/comment/head.jsp" %>
    <style type="text/css">

        .section {
            display: flex;
            justify-content: space-between;
            flex-wrap: wrap;
        }

        .flower {
            width: 300px;
            height: 420px;
            border: 1px solid rebeccapurple;
            margin: 20px 20px 10px 20px;

        }
        .callback{
            position: fixed;
            border: 1px solid darkblue;

            bottom: 20px;
            right: 20px;
        }
        .callback:hover{
            cursor: pointer;
        }
    </style>
</head>
<body>
<c:if test="${empty sessionScope.user}">
    <%@include file="/page/comment/head_nav.jsp" %>
</c:if>
<c:if test="${not empty sessionScope.user}">
    <%@include file="/page/user/head_nav.jsp"%>
</c:if>
<div class="section">
    <c:if test="${ empty requestScope.flowers}">
        <h3 style="text-align: center;color: gray">无相关鲜花产品信息</h3>
    </c:if>
    <c:if test="${not empty requestScope.flowers}">
        <c:forEach items="${requestScope.flowers}" var="item">
            <div class="flower">
                <img src="static/picFlower/${item.flower_photo}" alt="" width="100%" height="250px">
                <div style="height: 60px;margin-top: 10px;margin-bottom: 5px">
                    <span style="padding: 5px">${item.flower_name}</span>
                </div>
              <%--  <div style="height: 180px">
                    <span style="padding: 5px">${item.introduce}</span>
                </div>--%>
                <div style="height: 40px">
                    <span style="font-size: 25px">￥ &nbsp;&nbsp;</span>   <span style="color: red;font-size: 30px">${item.price}</span>
                </div>
                <div style="margin-top: 10px">
                    <button class="showDtail input-lg" flowerid="${item.flowerid}">查看详情</button>
                    <button flowerid="${item.flowerid}" class="cart input-lg">
                        Cart <span class="glyphicon glyphicon-shopping-cart"></span></button>
                </div>
            </div>
        </c:forEach>
    </c:if>

</div>
<div class="callback" >
    <img src="static/imges/icon/huidaodingbu.png" alt="">
</div>
</body>
<script>
    $(function () {

        $("button.showDtail").click(function () {
            var flowerid = $(this).attr("flowerid");
            location.href = "http://localhost:8080/onlineflower/client/flowerServlet?action=showFlowerDetail&flowerid=" + flowerid;
        });
        $("button.cart").click(function () {
            var flowerid = $(this).attr("flowerid");
            location.href = "http://localhost:8080/onlineflower/cartServlet?action=addItem&id=" + flowerid;
        });
        $('div.callback').click(function () {
            var y=window.scrollY;
            var x=window.scrollX;
            window.scrollTo(0,0);
            // alert("hello");
        });
    })
</script>
</html>
